package com.adds.lvds.model.code;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 代码设置类型
 * 
 * @author zhangjian
 * 
 */
public class SysCodeType {
	private String typeName;// 类型名称

	private String typeDesc;// 类型描述

	private boolean readOnly;// 只读
    private List<SysCode> codes = new ArrayList<SysCode>();
	
	private Map<String, SysCode> codeMap = new HashMap<String, SysCode>();
	
	public String getTypeName() {
		return typeName;
	}

	public void setTypeName(String typeName) {
		this.typeName = typeName.toUpperCase();
	}

	public String getTypeDesc() {
		return typeDesc;
	}

	public void setTypeDesc(String typeDesc) {
		this.typeDesc = typeDesc;
	}

	public boolean isReadOnly() {
		return readOnly;
	}

	public void setReadOnly(boolean readOnly) {
		this.readOnly = readOnly;
	}

	public List<SysCode> getCodes() {
		return codes;
	}

	public void setCodes(List<SysCode> codes) {
		this.codes = codes;
	}

	public Map<String, SysCode> getCodeMap() {
		return codeMap;
	}

	public void setCodeMap(Map<String, SysCode> codeMap) {
		this.codeMap = codeMap;
	}

	@Override
	public String toString() {
		StringBuffer sb = new StringBuffer("CodeType:\n");
		sb.append("Name:").append(getTypeName()).append("\n");
		sb.append("Description:").append(getTypeDesc()).append("\n");
		sb.append("ReadOnly:").append(isReadOnly()).append("\n");
		sb.append("Codes:").append("\n");
		for(int i = 0; codes != null && i < codes.size(); i++) {
			sb.append(codes.get(i));
		}
		
		return sb.toString();		
	}
	

}
